package com.cloud.school.app.util.mybatis;

import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;

import java.util.List;

/**
 * @ClassName BatchInsertMapper
 * @Description TODO
 * @Author 36297
 * @Date 2018/12/15 10:06
 * @Version 1.0
 */
@tk.mybatis.mapper.annotation.RegisterMapper
public interface BatchInsertMapper<T> {
    /**
     * 批量插入，支持批量插入的数据库可以使用，例如MySQL,H2等，另外该接口限制实体包含`id`属性并且必须为自增列
     *
     * @param recordList
     * @return
     */
    @Options(useGeneratedKeys = true)
    @InsertProvider(type = MysqlSpecialProvider.class, method = "dynamicSQL")
    int batchInsert(List<? extends T> recordList);
}
